﻿#ifndef SAVETASK_H
#define SAVETASK_H

#include <QObject>
#include <QRunnable>
#include <QImage>

#ifdef USE_HALCON
#include <Halcon.h>
#include <HalconCpp.h>
#endif

#ifdef USE_OPENCV
#include <opencv2/opencv.hpp>
#endif
enum ImageSaveType{
    IST_QIMG = 0,

#ifdef USE_OPENCV
    IST_CVIMG,
#endif

#ifdef USE_HALCON
    IST_HIMG
#endif
};
Q_DECLARE_METATYPE(ImageSaveType)

struct ImageSaveInfo{
    QString path;
    ImageSaveType saveType;
    QImage img;
#ifdef USE_OPENCV
    cv::Mat cvimg;
#endif
#ifdef USE_HALCON
    HalconCpp::HObject himg;
#endif
    ImageSaveInfo(){
        saveType = IST_QIMG;
    }
};
Q_DECLARE_METATYPE(ImageSaveInfo)

class SaveTask : public QRunnable
{
public:
    explicit SaveTask(ImageSaveInfo data);
    virtual void run() override;
signals:

private:
    ImageSaveInfo mData;
};

#endif // SAVETASK_H
